<template>
  <div class="SummaryOrdera">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">订单量汇总</span>
      </div>
      <s-table
        :table="table"
        @http="tableWatch">
        <el-form-item slot="multiSelect" label="多选操作" prop="multiSelect" v-if="table.multiSelect">
          <el-row>
            <el-col :span="8">
              <el-button size="small" type="info" @click="tableExport('')">多选导出</el-button>
            </el-col>
          </el-row>
        </el-form-item>
      </s-table>
    </el-card>
  </div>
</template>

<script>
  import {AutoVue, GetLodop} from '~/plugins/Tools';
  export default AutoVue({
    name: 'journaling_stockCountDaily-FEcarWms',
    head: {
      'title': '订单量汇总',
      'meta': [
        { 'hid': 'description', 'name': 'description', 'content': '乐速科技平台 订单量汇总 查看订单量汇总信息' },
      ],
    },
    data: {
      table: {
        column: [
          { label: '产品类别',
            prop: 'cplb',
            minWidth: '0px',
            search: true,
          },
          { label: '运单量',
            prop: 'ydl',
            minWidth: '0px',
            search: true,
          },
          { label: '订单量',
            prop: 'ddl',
            minWidth: '0px',
            search: true,
          },
          { label: '箱数',
            prop: 'xs',
            minWidth: '0px',
            search: false,
          },
          { label: '支数',
            prop: 'zs',
            minWidth: '0px',
            search: false,
          },
          { label: '销售额',
            prop: 'xse',
            minWidth: '0px',
            search: false,
          },
          { label: '运费',
            prop: 'yf',
            minWidth: '0px',
            search: false,
          },
          { label: '运费/销售额',
            prop: 'yfxse',
            minWidth: '0px',
            search: false,
          },
          { label: ' ',
            prop: 'hj',
            minWidth: '0px',
            search: false,
          },
          { label: '运单量合计',
            prop: 'ydlhj',
            minWidth: '0px',
          },
          { label: '订单量合计',
            prop: 'ddlhj',
            minWidth: '0px',
          },
          { label: '箱数合计',
            prop: 'xshj',
            minWidth: '0px',
          },
          { label: '支数合计',
            prop: 'zshj',
            minWidth: '0px',
          },
          { label: '销售额合计',
            prop: 'xsehj',
            minWidth: '0px',
          },
        ],
        url: '/wmsclassify/baseHarvestPage',
        key: 'zlid',
        tableColumn: 8,
        // summary: true,
        option: {
          // cjsj: '',
        },
      },
    },
    transition: 'slide-fade',
    methods: {
      // 打印测试
      // async printpaper (xbhid) {
      //   try {
      //     let contentList = ['http://ckd.im/9NDiR', 'http://ckd.im/vrEIL', 'http://ckd.im/9QPtf'];
      //     let LODOP = GetLodop();
      //     LODOP.PRINT_INIT('打印快递面单');
      //     for (let item of contentList) {
      //       LODOP.NewPage();
      //       LODOP.ADD_PRINT_URL(0, 0, 746, '100%', item);
      //       LODOP.SET_PRINT_STYLEA(0, 'HOrient', 3);
      //       LODOP.SET_PRINT_STYLEA(0, 'VOrient', 3);
      //     }
      //     LODOP.PREVIEW();
      //   } catch (err) {
      //     console.log(err);
      //   }
      // },
      tableExport (row) {
        let tableRef = 'table';
        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.zlid);
          });
        }
        this.$confirm('您将导出订单量汇总报表数据。', '确认导出？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              let option = Object.assign({}, this['autoVue_' + tableRef]);
              await this.p({
                url: '/wmsclassify/outClassify',
                method: 'post',
                responseType: 'blob',
                data: {
                  ids,
                  ...option,
                },
              });
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
    },
    mounted: function () {
      this.tableWatch('table');
    },
  });
</script>

<style scoped lang="scss">
</style>

<style lang="scss">
  .SummaryOrdera{
    width: 88vw;
    float: left;
  }
</style>
